      <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">
             <div class="row">
                    <div class="col-lg-12">
                        <h2 class="page-header">产品管理</h2>
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->
                <div class="row">
                    <div class="col-lg-12">
                              <div class="panel panel-default">
                        <div class="panel-heading">
                            产品信息  <?php if(isset($parent)){?><a href="<?=site_url()?>categories/viewCategory/<?=$parent->parent_id?>"><i class="fa fa-caret-left"></i> <?=$parent->name_cn?></a> <?php }?> <a class="btn btn-default btn-sm pull-right" href="<?=site_url()?>products/view/<?=$cat->id?>"><i class="fa fa-arrow-left"></i> 返回</a>
                       		<div class="clearfix"></div>
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">      
                        <?php if(isset($msg)){?>
                        <?php foreach ($msg as $m):?>
                        	<?php foreach ($m as $s):?>
                        <?php if($s['code']==1){?>
						<div class="alert alert-success">
						<?=$s['msg']?>
						</div>
						<?php }elseif($s['code']==2){?>
						<div class="alert alert-warning">
						<?=$s['msg']?>
						</div>
						<?php }else{?>
						<div class="alert alert-danger">
						<?=$s['msg']?>
						</div>
						<?php }?>
						<?php endforeach;?>
						<?php endforeach;?>
						<?php }?>
                        <form action="<?=current_url()?>" method="post">


							<div class="col-lg-12">
								<div class="panel panel-default">
									<div class="panel-heading">基本信息</div>
									<div class="panel-body">
									<div class="col-lg-4">
									<div class="catListRadio">

											<div class="form-group">
											<?=form_error('cat_id'); ?>
												<ul class="list-unstyled">
													
												<?=$category?>
												</ul>
											</div>
										</div>
										</div>
									<div class="col-lg-4">
										<div class="form-group">
											<label>中文 *</label> <input type="text" name="name_cn"
												value="<?=set_value('name_cn',$product->name_cn)?>"
												class="form-control">
												<?=form_error('name_cn'); ?>
										</div>
										<div class="form-group">
											<label>EN *</label> <input type="text" name="name_en"
												value="<?=set_value('name_en',$product->name_en)?>"
												class="form-control">
												<?=form_error('name_en'); ?>
										</div>
										<div class="form-group">
											<label>NL *</label> <input type="text" name="name_nl"
												value="<?=set_value('name_nl',$product->name_nl)?>"
												class="form-control">
												<?=form_error('name_nl'); ?>
										</div>
											<hr>
                            	<div class="form-group">
                            		<label>编号 *</label>
                            		<input type="text" name="reference" value="<?=set_value('reference',$product->reference_code)?>" class="form-control" placeholder="ABC-123456789">
                            		<?=form_error('reference'); ?>
                            	</div>
                            	<div class="form-group">
                            		<label>价格 </label>
                            		  <div class="input-group">
      <div class="input-group-addon"> €</div>
      <input type="text" name="price" value="<?=set_value('price', $product->price)?>" class="form-control" placeholder="可不填">
      <div class="input-group-addon">含税</div>
    </div>
                            	
                            		<?=form_error('price'); ?>
                            	</div>
                            	</div>
							<div class="col-lg-4">
										<div class="form-group">
											<label>Description EN </label>
											<textarea class="form-control" rows="3" name="text_en"><?=$product->description_en?></textarea>
										</div>
										<div class="form-group">
											<label>Description NL </label>
											<textarea class="form-control" rows="3" name="text_nl"><?=$product->description_nl?></textarea>
										</div>
										<hr>
										<div class="form-group pull-right">
											<button class="btn btn-primary btn-sm" type="submit">修改</button>
										</div>
									</div>
									</div>
								</div>
							</div>
							</form>
							<div class="col-lg-12">
					<div class="panel panel-default">
					<div class=" panel-heading">
						缩略图 <a href="<?=site_url()?>gallery/upload/<?=$product->id?>" class="btn btn-primary btn-xs pull-right"><i class="fa fa-plus-circle"></i> 添加照片</a>
					</div>
					<div class="panel-body">
					<?php if($photos){?>
					<?php $lastPosition = count($photos);?>
						<?php foreach ($photos as $photo):?>
						<div class="thumbnail ">
							<img src="<?=base_url()?>../uploads/thumbs/<?=$photo->filename_s?>">
							<div class="caption pull-right">
       <p><?php if($photo->active==1){?><span class="label label-success">active</span><?php }else{?><span class="label label-danger">disabled</span><?php }?></p>
        <h5>Description</h5>
     	
        <p><a href="#" class="btn btn-primary btn-sm" role="button"><i class="glyphicon glyphicon-pencil"></i></a> <button class="btn btn-danger btn-sm" role="button" onclick="deleteItem_2(<?=$photo->id?>,'<?=$photo->filename_s?>')"><i class="glyphicon glyphicon-trash"></i></button></p>
        <p><button class="btn btn-primary btn-xs" role="button" onclick="makeCover('<?=$photo->id?>','<?=$product->id?>');" <?php if ($photo->filename_s == $product->thumb){?>disabled<?php }?>>make as cover <i class="glyphicon glyphicon-picture"></i></button></p>
        <p>
         <button type="button" class="btn btn-primary btn-xs" onclick="position_up(<?=$photo->id?>);" <?php if($photo->position==1){?>disabled<?php }?>><i class="glyphicon glyphicon-circle-arrow-up"></i></button> 
				<?=$photo->position?> 
		<button type="button" class="btn btn-primary btn-xs" onclick="position_down(<?=$photo->id?>);" <?php if($lastPosition == $photo->position){?>disabled<?php }?>><i class="glyphicon glyphicon-circle-arrow-down"></i></button>	
        </p>
       <form actions="" method="post" role="form" class="form-inline" id="position_up_<?=$photo->id?>" enctype="multipart/form-data">			
				<input type="hidden" name="id" value="<?=$photo->id?>">
				<input type="hidden" name="position" value="<?=$photo->position?>">
				<input type="hidden" name="action" value="up">
			</form>
			<form actions="" method="post" role="form" class="form-inline" id="position_down_<?=$photo->id?>" enctype="multipart/form-data">
				<input type="hidden" name="id" value="<?=$photo->id?>">
				<input type="hidden" name="position" value="<?=$photo->position?>">
				<input type="hidden" name="action" value="down">
			</form>

      </div><div class="clearfix"></div>
						</div>
						<?php endforeach;?>
						<?php }else{?>
						<div class="alert alert-default">没有图片</div>
						<?php }?>
					</div>
		</div>			
                            </div>
                            
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->              
                
            </div>
        </div>
       